/**
 * Created by YX on 2016/10/23.
 *
 */

function clickPositionPoint(_this,floor,xPosition,yPosition,sampleTime,status,memberName,areaDesc) {
    // $(_this).parent().children(".point").each(
    //     function () {
    //         $(this).css({width:'10px',height:'10px'});
    //     }
    // );
    // $(_this).parent().child(".point").css({width:'10px',height:'10px'});
    $(".point").css({width:'10px',height:'10px'});
    $(_this).css({width:'20px',height:'20px'});
    $("#floor"+floor).text(floor.toString());
    $("#position"+floor).text("("+xPosition+","+yPosition+")");
    $("#time"+floor).text(sampleTime);
    $("#status"+floor).text(status==1?'正常':'预警');
    $("#memberName"+floor).text(memberName);
    $("#areaDesc"+floor).text(areaDesc);

}

function chengeMemberTrack() {
    var memberId = $("#selectMemberIdForTrack").val();
    $("#selectMemberIdForTrack").val(memberId);

    $("#main_context").empty();
    $("#main_context").load("/track/history?memberId="+memberId);


}

function searchTrack() {
    var params = {};
    params.memberId=$("#selectMemberIdForTrack").val();
    params.trackDayStr=$("#trackday").val();

    var a = /^(\d{4})-(\d{2})-(\d{2})$/;


    if(!a.test(params.trackDayStr)){
        alert("日期格式有误，请输入yyyy-mm-dd格式");
        return false;
    }
    $("#main_context").empty();
    $("#main_context").load("/track/history?memberId="+params.memberId+"&trackDayStr="+params.trackDayStr);

}

function showAreaPic(x,y,status,floor) {
    // alert("位置："+x+"，"+y);
    // $('#location_pic').css('display','block');
    var point_pic;
    if (status == 1)
        point_pic = "/images/green.png";
    else
        point_pic = "/images/red.png";
    var back_pic ;
    if (floor ==1 )
        back_pic = "/img/map_new.jpg";
    else
        back_pic = "/img/map2.jpeg";
    $("#location_pic").remove();

    $("#main_section").append(

    '<div class="row">'+
        '<div id="location_pic" class="col-md-12">'+
        '<div class="box box-primary"> <div class="box-header"> <h3 class="box-title">位置图</h3>'+
        '<div class="box-tools pull-right">'+
        '<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>'+
        '<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>'+
        '</div>'+
        '</div>'+
        '<div class="box-body">'+
        '<div style="width:100%;height:400px;'+
        'background:url('+back_pic+');'+
        'background-size:100% 100%; ">'+
    '<div style="width:99%; height:99%;">'+
        '<img class="point" src="'+point_pic+'"'+
    'width="20px"; height="20px"; style="position:absolute; left:'+x+'px;bottom:'+y+'px;">'+
    '</div></div></div></div></div></div>'
    )
}